home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / misc / o-z / x-windows / mesa-amiwin / src / vb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-30  |  4.3 KB  |  156 lines

  1. /* vb.h */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  6.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25. $Id: vb.h,v 1.10 1995/10/17 21:43:56 brianp Exp $
  26.  
  27. $Log: vb.h,v $
  28.  * Revision 1.10  1995/10/17  21:43:56  brianp
  29.  * updated a few comments because of new device driver
  30.  *
  31.  * Revision 1.9  1995/09/28  19:38:44  brianp
  32.  * replaced ClipFlag[] with Unclipped[]
  33.  *
  34.  * Revision 1.8  1995/09/25  19:24:33  brianp
  35.  * added per-vertex glMaterial data structures
  36.  *
  37.  * Revision 1.7  1995/09/22  16:48:55  brianp
  38.  * added AnyClipped and prototype Unclipped[[] and MonoColor fields to VB
  39.  *
  40.  * Revision 1.6  1995/09/13  14:48:18  brianp
  41.  * updated VB struct for "vectorized" draw.c
  42.  *
  43.  * Revision 1.5  1995/06/20  16:19:54  brianp
  44.  * unconditionally include integer win coord arrays
  45.  *
  46.  * Revision 1.4  1995/06/15  19:37:28  brianp
  47.  * added integer window coords arrays, an experiment
  48.  *
  49.  * Revision 1.3  1995/06/02  13:55:34  brianp
  50.  * changed from MAX_VERTICES to VB_MAX and VB_SIZE
  51.  *
  52.  * Revision 1.2  1995/05/22  20:59:34  brianp
  53.  * Release 1.2
  54.  *
  55.  * Revision 1.1  1995/03/24  15:32:17  brianp
  56.  * Initial revision
  57.  *
  58.  */
  59.  
  60.  
  61. /*
  62.  * Vertex buffer:  vertices from glVertex* are accumulated here until
  63.  * the buffer is full or glEnd() is called.  Then the buffer is flushed
  64.  * (rendered) and reset.
  65.  */
  66.  
  67.  
  68. #ifndef VB_H
  69. #define VB_H
  70.  
  71.  
  72. #include "context.h"
  73.  
  74.  
  75.  
  76. /*
  77.  * Used in the bitmask for recording glMaterial calls between glBegin/glEnd:
  78.  */
  79. #define FRONT_AMBIENT_BIT     0x1
  80. #define BACK_AMBIENT_BIT      0x2
  81. #define FRONT_DIFFUSE_BIT     0x4
  82. #define BACK_DIFFUSE_BIT      0x8
  83. #define FRONT_SPECULAR_BIT   0x10
  84. #define BACK_SPECULAR_BIT    0x20
  85. #define FRONT_EMISSION_BIT   0x40
  86. #define BACK_EMISSION_BIT    0x80
  87. #define FRONT_SHININESS_BIT 0x100
  88. #define BACK_SHININESS_BIT  0x200
  89. #define FRONT_INDEXES_BIT   0x400
  90. #define BACK_INDEXES_BIT    0x800
  91.  
  92.  
  93.  
  94. /* Flush VB when this number of vertices is accumulated:  (a multiple of 12) */
  95. #define VB_MAX 252
  96.  
  97. /* Arrays must also accomodate new vertices from clipping: */
  98. #define VB_SIZE  (VB_MAX + 2 * (6 + MAX_CLIP_PLANES))
  99.  
  100.  
  101. /*
  102.  * Vertex buffer (not saved/restored on context switches)
  103.  */
  104. struct vertex_buffer {
  105.         GLfloat Obj[VB_SIZE][4];        /* Object coords */
  106.     GLfloat Eye[VB_SIZE][4];    /* Eye coords */
  107.     GLfloat Clip[VB_SIZE][4];    /* Clip coords */
  108.     GLfloat Win[VB_SIZE][3];    /* Window coords */
  109.  
  110.         GLfloat Normal[VB_SIZE][3];     /* Normal vectors */
  111.  
  112.     GLfloat Fcolor[VB_SIZE][4];    /* Front colors */
  113.     GLfloat Bcolor[VB_SIZE][4];    /* Back colors */
  114.     GLfloat (*Color)[4];        /* == Fcolor or Bcolor */
  115.     GLfloat    Findex[VB_SIZE];    /* Front indexes */
  116.     GLfloat    Bindex[VB_SIZE];    /* Back indexes */
  117.     GLfloat *Index;            /* == Findex or Bindex */
  118.  
  119.     GLboolean Edgeflag[VB_SIZE];    /* Polygon edge flag */
  120.  
  121.         GLfloat TexCoord[VB_SIZE][4];   /* Texture coords */
  122.  
  123.         GLubyte Unclipped[VB_SIZE];    /* 0=clipped, 1=not clipped */
  124.         GLboolean AnyClipped;        /* Were any vertices clipped? */
  125.  
  126.     GLuint Start;            /* First vertex to process */
  127.     GLuint Count;            /* Number of vertexes in buffer */
  128.     GLuint Free;            /* Next empty position for clipping */
  129.  
  130.         /* to handle glMaterial calls inside glBegin/glEnd: */
  131.     GLboolean MaterialChanges;    /* True if any glMaterial was called */
  132.         GLuint MaterialMask[VB_SIZE];    /* What material values to change */
  133.     struct gl_material Material[VB_SIZE][2]; /* New material settings */
  134.  
  135.         GLboolean MonoColor;        /* Do all vertices have same color? */
  136.  
  137. #ifdef LEAVEOUT
  138.     /* NEW for 1.2.? */
  139.     GLint WinX[VB_SIZE];    /* Scaled integer window coords */
  140.     GLint WinY[VB_SIZE];
  141.     GLint WinZ[VB_SIZE];
  142. #endif
  143. };
  144.  
  145.  
  146.  
  147.  
  148. extern struct vertex_buffer VB;
  149.  
  150.  
  151. extern void gl_init_vb( void );
  152.  
  153.  
  154. #endif
  155.  
  156.